package com.cn.sys.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cn.sys.dao.SysUserDao;
import com.cn.sys.entity.SysUserEntity;
import com.cn.sys.service.SysUserService;


/**
 * @ClassName: SysUserServiceImpl
 * @Description: TODO
 * @author Administrator
 * @date 2017年6月16日
 */
@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService{
	
	@Autowired
	private SysUserDao dao;
	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param userId
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryAllPerms(java.lang.Long)
	 */
	    
	@Override
	public List<String> queryAllPerms(String userId) {
		// TODO Auto-generated method stub
		return dao.queryAllPerms(userId);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param userId
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryAllMenuId(java.lang.Long)
	 */
	    
	@Override
	public List<Long> queryAllMenuId(String userId) {
		// TODO Auto-generated method stub
		return dao.queryAllMenuId(userId);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param username
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryByUserName(java.lang.String)
	 */
	    
	@Override
	public SysUserEntity queryByUserName(String username) {
		// TODO Auto-generated method stub
		return dao.queryByUserName(username);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param userId
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryObject(java.lang.Long)
	 */
	    
	@Override
	public SysUserEntity queryObject(String userId) {
		// TODO Auto-generated method stub
		return dao.queryObject(userId);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param map
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryList(java.util.Map)
	 */
	    
	@Override
	public List<SysUserEntity> queryList(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return dao.queryList(map);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param map
	 * @return
	 * @see com.cn.service.sys.SysUserService#queryTotal(java.util.Map)
	 */
	    
	@Override
	public int queryTotal(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return dao.queryTotal();
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param user
	 * @see com.cn.service.sys.SysUserService#save(com.cn.entity.sys.SysUserEntity)
	 */
	    
	@Override
	public void save(SysUserEntity user) {
		// TODO Auto-generated method stub
		dao.save(user);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param user
	 * @see com.cn.service.sys.SysUserService#update(com.cn.entity.sys.SysUserEntity)
	 */
	    
	@Override
	public void update(SysUserEntity user) {
		// TODO Auto-generated method stub
		dao.update(user);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param userIds
	 * @see com.cn.service.sys.SysUserService#deleteBatch(java.lang.Long[])
	 */
	    
	@Override
	public void deleteBatch(Long[] userIds) {
		// TODO Auto-generated method stub
		dao.deleteBatch(userIds);
	}

	
	/* (非 Javadoc)
	 * 
	 * 
	 * @param userId
	 * @param password
	 * @param newPassword
	 * @return
	 * @see com.cn.service.sys.SysUserService#updatePassword(java.lang.Long, java.lang.String, java.lang.String)
	 */
	    
	@Override
	public int updatePassword(String userId, String password, String newPassword) {
		// TODO Auto-generated method stub
		Map map =new HashMap();
		map.put("userId", userId);
		map.put("password", password);
		map.put("newPassword", newPassword);
		return dao.updatePassword(map);
	}

}
